package com.cheng.example.atguigu.view2;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 比较并交换演示
 */
public class Client12 {

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 2015)+"\t current data："+atomicInteger.get());

        System.out.println(atomicInteger.compareAndSet(5, 2014)+"\t current data："+atomicInteger.get());
    }
}
